<?php
// +----------------------------------------------------------------------
// | @filename AdminUserTransformer.php
// +----------------------------------------------------------------------
// | @author 落花轻舞问君愁 <mwcx1990@qq.com>
// +----------------------------------------------------------------------
// | @datetime 2021-10-26 18:46:51
// +----------------------------------------------------------------------
// | @Description
// +----------------------------------------------------------------------

namespace Addons\Backend\Transformers;


use Addons\Backend\Models\AdminUser;

class AdminUserTransformer extends BaseTransformer
{
    public function transform(AdminUser $adminUser)
    {
        return [
            'id' => $adminUser->id,
            'username' => $adminUser->username,
            'nickname' => $adminUser->nickname,
            'avatar' => $adminUser->avatar ? url($adminUser->avatar) : '',
            'gender' => $adminUser->gender,
            'email' => (string)$adminUser->email,
            'mobile' => $adminUser->mobile,
            'status' => $adminUser->status,
            'created_at' => $adminUser->created_at->toDateTimeString(),
            'updated_at' => $adminUser->updated_at->toDateTimeString()
        ];
    }
}
